package com.dinzeer.slashblade_project_slr.data;

import com.dinzeer.slashblade_project_slr.Slashblade_project_slr;
import com.dinzeer.slashblade_project_slr.regsiter.SLRItemRegsitry;
import com.dinzeer.slashblade_project_slr.regsiter.SLRSlashArtRegsitry;
import com.dinzeer.slashblade_project_slr.regsiter.SLRSpeacialEffectRegsitry;

import mods.flammpfeil.slashblade.item.SwordType;
import mods.flammpfeil.slashblade.registry.slashblade.EnchantmentDefinition;
import mods.flammpfeil.slashblade.registry.slashblade.PropertiesDefinition;
import mods.flammpfeil.slashblade.registry.slashblade.RenderDefinition;
import mods.flammpfeil.slashblade.registry.slashblade.SlashBladeDefinition;
import net.minecraft.data.worldgen.BootstapContext;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.enchantment.Enchantment;
import net.minecraft.world.item.enchantment.Enchantments;
import net.minecraftforge.registries.ForgeRegistries;

import java.awt.*;
import java.util.Arrays;
import java.util.List;

public class SLRBuiltInRegsitry {
    public static final ResourceKey<SlashBladeDefinition> SLR001 = register("slr_001");
    public static final ResourceKey<SlashBladeDefinition> SLR002 = register("slr_002");
    public static final ResourceKey<SlashBladeDefinition> SLR003 = register("slr_003");
    public static final ResourceKey<SlashBladeDefinition> SLR004 = register("slr_004");
    public static final ResourceKey<SlashBladeDefinition> SLR005 = register("slr_005");
    public static final ResourceKey<SlashBladeDefinition> SLR006 = register("slr_006");
    public static void registerAll(BootstapContext<SlashBladeDefinition> bootstrap) {
        bootstrap.register(
                SLR001, new SlashBladeDefinition(
                        SLRItemRegsitry.SLR_SLASH_BLADE.getId(),
                        Slashblade_project_slr.prefix("slr_001"),
                        RenderDefinition.Builder.newInstance()
                                .textureName(Slashblade_project_slr.prefix("model/slr_001/sirius_a.png"))
                                .modelName(Slashblade_project_slr.prefix("model/slr_001/sirius_a.obj"))
                                .effectColor(0xFF00FFFF)
                                .build(),
                        PropertiesDefinition.Builder.newInstance()
                                .defaultSwordType(List.of(SwordType.BEWITCHED))
                                .baseAttackModifier(21)
                                .maxDamage(300)
                                .build(),
                        List.of(
                                new EnchantmentDefinition(getEnchantmentID(Enchantments.SHARPNESS), 5),
                                new EnchantmentDefinition(getEnchantmentID(Enchantments.FIRE_ASPECT), 2)
                        )
//                        PbdCreativeTab.Slashblade.getId()
                ));
        bootstrap.register(
                SLR002, new SlashBladeDefinition(
                        SLRItemRegsitry.SLR_SLASH_BLADE.getId(),
                        Slashblade_project_slr.prefix("slr_002"),
                        RenderDefinition.Builder.newInstance()
                                .textureName(Slashblade_project_slr.prefix("model/slr_002/sirius_b.png"))
                                .modelName(Slashblade_project_slr.prefix("model/slr_002/sirius_b.obj"))
                                .effectColor(Color.RED.getRGB())
                                .build(),
                        PropertiesDefinition.Builder.newInstance()
                                .defaultSwordType(List.of(SwordType.BEWITCHED))
                                .slashArtsType(SLRSlashArtRegsitry.SLR_002_SA.getId())
                                .baseAttackModifier(21)
                                .maxDamage(300)
                                .build(),
                        List.of(
                                new EnchantmentDefinition(getEnchantmentID(Enchantments.SHARPNESS), 5),
                                new EnchantmentDefinition(getEnchantmentID(Enchantments.FIRE_ASPECT), 2)
                        )
//                        PbdCreativeTab.Slashblade.getId()
                ));
        bootstrap.register(
                SLR003, new SlashBladeDefinition(
                        SLRItemRegsitry.SLR_SLASH_BLADE.getId(),
                        Slashblade_project_slr.prefix("slr_003"),
                        RenderDefinition.Builder.newInstance()
                                .textureName(Slashblade_project_slr.prefix("model/slr_003/sirius_c.png"))
                                .modelName(Slashblade_project_slr.prefix("model/slr_003/sirius_c.obj"))
                                .effectColor(0xFFFFFF00)
                                .build(),
                        PropertiesDefinition.Builder.newInstance()
                                .defaultSwordType(List.of(SwordType.BEWITCHED))
                                .addSpecialEffect(SLRSpeacialEffectRegsitry.WitherEdges.getId())
                                .baseAttackModifier(21)
                                .maxDamage(300)
                                .build(),
                        List.of(
                                new EnchantmentDefinition(getEnchantmentID(Enchantments.SHARPNESS), 5),
                                new EnchantmentDefinition(getEnchantmentID(Enchantments.FIRE_ASPECT), 2)
                        )
//                        PbdCreativeTab.Slashblade.getId()
                ));
        bootstrap.register(
                SLR004, new SlashBladeDefinition(
                        SLRItemRegsitry.SLR_SLASH_BLADE.getId(),
                        Slashblade_project_slr.prefix("slr_004"),
                        RenderDefinition.Builder.newInstance()
                                .textureName(Slashblade_project_slr.prefix("model/slr_004/sirius_c.png"))
                                .modelName(Slashblade_project_slr.prefix("model/slr_004/sirius_c.obj"))
                                .effectColor(0xFF98FB98)
                                .build(),
                        PropertiesDefinition.Builder.newInstance()
                                .defaultSwordType(List.of(SwordType.BEWITCHED))
                                .baseAttackModifier(21)
                                .maxDamage(300)
                                .build(),
                        List.of(
                                new EnchantmentDefinition(getEnchantmentID(Enchantments.SHARPNESS), 5),
                                new EnchantmentDefinition(getEnchantmentID(Enchantments.FIRE_ASPECT), 2)
                        )
//                        PbdCreativeTab.Slashblade.getId()
                ));
        bootstrap.register(
                SLR005, new SlashBladeDefinition(
                        SLRItemRegsitry.SLR_SLASH_BLADE.getId(),
                        Slashblade_project_slr.prefix("slr_005"),
                        RenderDefinition.Builder.newInstance()
                                .textureName(Slashblade_project_slr.prefix("model/slr_005/sirius_e.png"))
                                .modelName(Slashblade_project_slr.prefix("model/slr_005/sirius_e.obj"))
                                .effectColor(0xFFFFD700)
                                .build(),
                        PropertiesDefinition.Builder.newInstance()
                                .defaultSwordType(List.of(SwordType.BEWITCHED))
                                .baseAttackModifier(21)
                                .maxDamage(300)
                                .build(),
                        List.of(
                                new EnchantmentDefinition(getEnchantmentID(Enchantments.SHARPNESS), 5),
                                new EnchantmentDefinition(getEnchantmentID(Enchantments.FIRE_ASPECT), 2)
                        )
//                        PbdCreativeTab.Slashblade.getId()
                ));
        bootstrap.register(
                SLR006, new SlashBladeDefinition(
                        SLRItemRegsitry.SLR_SLASH_BLADE.getId(),
                        Slashblade_project_slr.prefix("slr_006"),
                        RenderDefinition.Builder.newInstance()
                                .textureName(Slashblade_project_slr.prefix("model/slr_006/sirius_f.png"))
                                .modelName(Slashblade_project_slr.prefix("model/slr_006/sirius_f.obj"))
                                .effectColor(0xFFDDA0DD)
                                .build(),
                        PropertiesDefinition.Builder.newInstance()
                                .defaultSwordType(List.of(SwordType.BEWITCHED))
                                .addSpecialEffect(SLRSpeacialEffectRegsitry.WitherUnEdge.getId())
                                .baseAttackModifier(21)
                                .maxDamage(300)
                                .build(),
                        List.of(
                                new EnchantmentDefinition(getEnchantmentID(Enchantments.SHARPNESS), 5),
                                new EnchantmentDefinition(getEnchantmentID(Enchantments.FIRE_ASPECT), 2)
                        )
//                        PbdCreativeTab.Slashblade.getId()
                ));
    }




    private static ResourceKey<SlashBladeDefinition> register(String id) {
        return ResourceKey.create(SlashBladeDefinition.REGISTRY_KEY, Slashblade_project_slr.prefix(id));
    }
    static ResourceLocation getEnchantmentID(Enchantment enchantment) {
        return ForgeRegistries.ENCHANTMENTS.getKey(enchantment);
    }

}
